<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="../../assets/css/layui.css">
    <link rel="stylesheet" href="../../assets/css/view.css"/>
    <title></title>
</head>
<body class="layui-view-body">
<div class="layui-content">
    <div class="layui-row">
        <div class="layui-card">
            <div class="layui-card-header">录入快件</div>
            <form class="layui-form layui-card-body" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">单号</label>
                    <div class="layui-input-block">
                        <input id="number" type="text" name="number" required lay-verify="required" placeholder="请输入快递单号"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">快递公司</label>
                    <div class="layui-input-block">
                        <select id="company" name="company" lay-verify="" lay-search>
                            <option >百世快运</option>
                            <option value="德邦快递">德邦快递</option>
                            <option value="EMS">EMS</option>
                            <option value="京东快递">京东快递</option>
                            <option value="京广速递">京广速递</option>
                            <option value="申通快递">申通快递</option>
                            <option selected="selected">顺丰速运</option>
                            <option value="圆通速递">圆通速递</option>
                            <option value="优速物流">优速物流</option>
                            <option value="邮政国际包裹">邮政国际包裹</option>
                            <option value="中通快递">中通快递</option>
                            <option value="宅急送">宅急送</option>
                            <option value="中国邮政">中国邮政</option>
                        </select>

                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">收件人姓名</label>
                    <div class="layui-input-block">
                        <input id="username" type="text" name="username" required lay-verify="required" placeholder="请输入收货人姓名"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">手机号码</label>
                    <div class="layui-input-block">
                        <input id="phonenumber" type="text" name="phonenumber" required lay-verify="required" placeholder="请输入手机号码"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button id="go" type="button" class="layui-btn layui-btn-blue" lay-submit lay-filter="formDemo">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script src="/qrcode/jquery2.1.4.js"></script>
<script src="/layer/layer.js"></script>
<script src="../../assets/layui.all.js"></script>
<script>
    var form = layui.form
        , layer = layui.layer;
</script>
<script>
    $(function () {
        $("#go").click(function () {
            var number = $("#number").val();
            var userName = $("#username").val();
            var company = $("#company").val();
            var phoneNumber = $("#phonenumber").val();

            //加载状态
            var windowId = layer.load();


            $.post("/express/add.do",{number:number,userName:userName,company:company,phoneNumber:phoneNumber},function (data) {
                //关闭加载状态
                layer.close(windowId);
                //4.    将服务器回复的结果进行显示
                layer.msg(data.result);

                if(data.status == 0){
                    layer.msg("录入成功");
                    $("#number").val("");
                    $("#username").val("");
                    $("#company").val("顺丰速运");
                    $("#phonenumber").val("");

                }

            },"JSON");

        });
    });

</script>
</body>
</html>
